#include "processBar.h"
typedef void (*callback_t)(int);    //函数指针类型

void downlowd(callback_t cb,int curr)  //cur为传入的初始内存
{
    while(curr<=MEMORY)
    {
        int rate=(curr*100)/MEMORY; //计算百分比
        cb(rate);   //回调函数
        curr+=10;
        fflush(stdout);

        usleep(SLEEPTIME);
    }
    printf("\n");
}

int main()
{
    printf("process1:\n");
    downlowd(processbar,0);
    Clear();
    printf("process2:\n");
    downlowd(processbar,500);
    Clear();
    return 0;
}
